<?php
/**
 * This file contains the class FDSubmitView which provides
 * all of the text requirements for the FDSubmit page
 *
 * @copyright  2009 A Memory Tree
 * @license    A Memory Tree License
 * @version    $Id:$
 * @link       http://my-trac.assembla.com/amemorytree/ticket/??
 * @since      File available since Release 0.1
 */
/**
 * This class provides the text for FDSubmit
 *
 * @copyright  2009 A Memory Tree
 * @license    A Memory Tree License
 * @version    Release: @package_version@
 * @link       http://my-trac.assembla.com/amemorytree/ticket/??
 * @since      Class available since Release 0.1
 */
class FDSubmitView
{
    /**
      * A place to store pre-prepared messages
     *
     * @var array[string]string
     */
    private $_text;
    /**
      * The html class that provides helpers to display the text
     *
     * @var Html
     */
    private $_html;
    /**
     * Builds the list of text messages
     * 
     * @return void
     * @param Html &$html
     */
    function __construct(&$html)
    {
        $this->_html = $html;
        $this->_text['loginMessage'] = '<div id="contentarea">Please log in to view this page.<br /><br />You can log in at the <a href="member.php?return='.$_SERVER['PHP_SELF'].'">Member page</a>.<p>&nbsp;</p></div>';
    }
    /**
     * Return the text that's associated with the given name
     * 
     * @return string
     * @param string $name
     */
    function get($name)
    {
        return $this->_text[$name];
    }
    /**
     * Send a success email to the funeral director
     * 
     * @return string
     * @param string $funeralHome
     * @param string $personName
     * @param string $personId
     */
    public function remembranceSuccessEmail($funeralHome, $personName, $personId)
    {
        $funeralHome = $this->_html->text($funeralHome);
        $personName = $this->_html->text($personName);
        $personId = $this->_html->text($personId);
        return <<< EOT
<html>
    <body>
        <div style="width:550px;margin:0 auto;">
            <p>Hi $funeralHome,</p>
            <p>This is to advise that you have successfully opened a Remembrance Page for $personName</p>
            <p><a href="http://amemorytree.co.nz/remembrance.php?personid=$personId">http://amemorytree.co.nz/remembrance.php?personid=$personId</a></p>
            <p>You can now advertise the page to the wider community, and friends of $personName.</p>
            <p>If you did not create this Remembrance Page, please contact us at <a href="mailto:funeralmatters@amemorytree.co.nz">funeralmatters@amemorytree.co.nz</a> immediately.</p>
            <p>Many thanks for your support.</p>
            <p><a href="mailto:theteam@amemorytree.co.nz">theteam@amemorytree.co.nz</a></p>
            <div style="background-color:#E6F1F9;padding:5px">
                <p><strong>Did this email go into your junk mail folder on Microsoft Outlook?</strong><br>
                  You can either:</p>
                <p>Add theteam@amemorytree.co.nz to your address book to make sure our emails arrive in your inbox or,</p>
                <p>Simply drag the mail from your junk mail box to your inbox. This now accepts all future mail from theteam@amemorytree.co.nz</p>
            </div>
        </div>
    </body>
</html>

EOT;
    }
    /**
     * Send a success email to the team
     * 
     * @return string
     * @param string $funeralHome
     * @param string $personName
     * @param string $personId
     */
    public function theteamSuccessEmail($funeralHome, $personName, $personId)
    {
        $funeralHome = $this->_html->text($funeralHome);
        $personName = $this->_html->text($personName);
        $personId = $this->_html->text($personId);
        $date = strtotime('now');
        return <<< EOT
<html>
    <body>
        <div style="width:550px;margin:0 auto;">
            <p>$funeralHome opened a Remembrance Page for $personName</p>
            <p>http://amemorytree.co.nz/remembrance.php?personid=$personId</p>
            <p>This was created on $date</p>
        </div>
    </body>
</html>

EOT;
    }
}
